define(['app'],function(app){return {module: function($scope, $http, eventBusService, httpService, params) {

	$scope.form = {};

	$scope.save = function() {
		if (!$scope.formCheck()){
			return;
		}
		httpService.post(app.urls.employ_insert, $scope.form, function (data) {
			if (data.code == "0000") {
				let ids = "'"+data.data+"'";
				httpService.post(app.urls.addTeacher, $scope.form, function (data) {
					if (data.code == "0000") {
						let fk_teacher = data.data;
						httpService.post(app.urls.employ_update, {'ids':ids, 'fk_teacher':fk_teacher}, function (data) {});
					}
				});
				eventBusService.publish("content.page.reload", data);
				eventBusService.publish("modal.page.close", {});
			} else {
				eventBusService.publish("modal.alert", {"content": data.msg});
			}
		});
	}

	//性别
	$scope.getSexList = function (){
		httpService.post(app.urls.dictionary_selectByRule,{fk_rule:"SJAAAAA29"},function(data){
			if("0000" === data.code){
				$scope.sexList = data.data;
			}else{
				alert(data.msg);
			}
		});
	}

	let init = function () {
		$scope.getSexList();
	}

	init();

}}});